package net.borlis.sample.services.facade.ws.request;

import net.borlis.dictionaries.product.SaleType;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

/**
 * @author alex@borlis.net on 05.06.2014.
 */
@XmlRootElement
public class ConfigureVitoProviderRequest {

    private Long vitoId;

    private Long providerId;

    private SaleType saleType;

    private Boolean enabled;

    public ConfigureVitoProviderRequest() {
    }

    public ConfigureVitoProviderRequest(Long vitoId, Long providerId, SaleType saleType, Boolean enabled) {
        this.vitoId = vitoId;
        this.providerId = providerId;
        this.saleType = saleType;
        this.enabled = enabled;
    }

    @XmlElement
    public Long getVitoId() {
        return vitoId;
    }

    @XmlElement
    public Long getProviderId() {
        return providerId;
    }

    @XmlElement
    public SaleType getSaleType() {
        return saleType;
    }

    @XmlElement
    public Boolean getEnabled() {
        return enabled;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof ConfigureVitoProviderRequest) {
            ConfigureVitoProviderRequest other = (ConfigureVitoProviderRequest) obj;
            EqualsBuilder builder = new EqualsBuilder();
            builder.append(getVitoId(), other.getVitoId());
            builder.append(getProviderId(), other.getProviderId());
            builder.append(getSaleType(), other.getSaleType());
            return builder.isEquals();
        }
        return false;
    }

    @Override
    public int hashCode() {
        HashCodeBuilder builder = new HashCodeBuilder();
        builder.append(getVitoId());
        builder.append(getProviderId());
        builder.append(getSaleType());
        return builder.toHashCode();
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this).
                append("vito", getVitoId()).
                append("provider", getProviderId()).
                append("saleType", getSaleType()).
                append("enabled", getEnabled()).
                toString();
    }
}
